package com.server.pinggu.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.server.common.utils.StringUtils;

/**
 * @Classname FengRui
 * @Description
 * @Date 2022-10-27 10:12
 */
public class SBLX implements Converter<Integer> {
    @Override
    public Class supportJavaTypeKey() {
        return null;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        String stringValue = cellData.getStringValue();
        if (StringUtils.isEmpty(stringValue)) {
            return 1;
        }
        if (stringValue.equals("一般居保人员") || stringValue.equals("一般职保退休")) {
            return 1;
        }
        if (stringValue.equals("非长护险人员")) {
            return 2;
        }
        if (stringValue.equals("本市老红军")||stringValue.equals("离休干部")||stringValue.equals("革命伤残军人")) {
            return 3;
        }
        if (stringValue.contains("互助帮困") || stringValue.contains("居保高龄老人") || stringValue.contains("居保重残人员") ) {
            return 4;
        }
        if (stringValue.equals("复评")) {
            return 5;
        }
        else {
            return 1;
        }
    }

    @Override
    public CellData convertToExcelData(Integer s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return null;
    }
}
